#!/usr/bin/env python

import os
import sys
import re

Import('*')
local_env = env.Clone()

local_env.Append(RESOURCE_TEMPLATE_VARS = {
	'VERSION': env['GPICK_BUILD_VERSION'],
	'VERSION_COMMA': env['GPICK_BUILD_VERSION'].replace('.', ','),
	'REVISION': env['GPICK_BUILD_REVISION'],
	'BUILD_DATE': env['GPICK_BUILD_DATE'],
})

sources = local_env.Glob('*.rct')
resources = local_env.AlwaysBuild(local_env.ResourceTemplate(sources))
objects = local_env.RES(resources)

Command("gpick-icon.ico", File("gpick-icon.ico").srcnode(), Copy("$TARGET", "${SOURCE}"))
if not (env['TOOLCHAIN'] == 'msvc'):
	Command("gpick.exe.manifest", File("gpick.exe.manifest").srcnode(), Copy("$TARGET", "${SOURCE}"))

Depends(resources, 'gpick-icon.ico')
if not (env['TOOLCHAIN'] == 'msvc'):
	Depends(resources, 'gpick.exe.manifest')

Return('objects')
